package pl.prv.polanie.client.filemanager;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

public class Tooltip extends Composite {

	private static final String STYLE__TOOLTIP = "swo-Tooltip";
	private static final String STYLE__TOOLTIP__LEFT_TOP_ARROW = "swo-Tooltip-leftTopArrow";
	
	private static final String STYLE__TOOLTIP__TOP = "swo-Tooltip-top";
	private static final String STYLE__TOOLTIP__BOTTOM = "swo-Tooltip-bottom";
	private static final String STYLE__TOOLTIP__LEFT = "swo-Tooltip-left";
	private static final String STYLE__TOOLTIP__RIGHT = "swo-Tooltip-right";
	
//	private static final String STYLE__TOOLTIP__LEFT_TOP = "swo-Tooltip-leftTop";
	private static final String STYLE__TOOLTIP__RIGHT_TOP = "swo-Tooltip-rightTop";
	private static final String STYLE__TOOLTIP__LEFT_BOTTOM = "swo-Tooltip-leftBottom";
	private static final String STYLE__TOOLTIP__RIGHT_BOTTOM = "swo-Tooltip-rightBottom";
	
	

	
//	SimplePanel mainSP = new SimplePanel();
	FlexTable mainFT = new FlexTable();
	
	public Tooltip(Widget widget) {
		initWidget(mainFT);
		mainFT.setStyleName(STYLE__TOOLTIP);
		mainFT.setCellPadding(0);
		mainFT.setCellSpacing(0);
		

		//GORA, DOL, LEWO, PRAWO
		Label wTop = new Label();
		wTop.setWidth("100%");
		wTop.setHeight(30+"px");
		wTop.setStyleName(STYLE__TOOLTIP__TOP);
		mainFT.setWidget(0, 1, wTop);
		
		Label wBottom = new Label();
		wBottom.setWidth("100%");
		wBottom.setHeight(30+"px");
		wBottom.setStyleName(STYLE__TOOLTIP__BOTTOM);
		mainFT.setWidget(2, 1, wBottom);
		
		mainFT.getCellFormatter().setStyleName(1, 0, STYLE__TOOLTIP__LEFT);
		mainFT.getCellFormatter().setStyleName(1, 2, STYLE__TOOLTIP__RIGHT);
		

		
		
		//NAROZNIKI
		Label wRightTop = new Label();
		wRightTop.setWidth("27px");
		wRightTop.setHeight("30px");
		wRightTop.setStyleName(STYLE__TOOLTIP__RIGHT_TOP);
		mainFT.setWidget(0, 2, wRightTop);

		Label wRightBottom = new Label();
		wRightBottom.setWidth("27px");
		wRightBottom.setHeight("30px");
		wRightBottom.setStyleName(STYLE__TOOLTIP__RIGHT_BOTTOM);
		mainFT.setWidget(2, 2, wRightBottom);
		
//		Label wLeftTop = new Label();
//		wLeftTop.setWidth("27px");
//		wLeftTop.setHeight("100%");
//		wLeftTop.setStyleName(STYLE__TOOLTIP__LEFT_TOP);
//		mainFT.setWidget(0, 0, wRightTop);
		
		Label wLeftBottom = new Label();
		wLeftBottom.setWidth("27px");
		wLeftBottom.setHeight("30px");
		wLeftBottom.setStyleName(STYLE__TOOLTIP__LEFT_BOTTOM);
		mainFT.setWidget(2, 0, wLeftBottom);
		
		
		
		//OSTRY NAROZNIK
		Label wLeftTop = new Label();
		wLeftTop.setWidth(27+"px");
		wLeftTop.setHeight(30+"px");
		wLeftTop.setStyleName(STYLE__TOOLTIP__LEFT_TOP_ARROW);
		mainFT.setWidget(0, 0, wLeftTop);
		
		
		mainFT.setWidget(1, 1, widget);
	}
	
	public void setWidgetInTooltip(Widget widget) {
		mainFT.setWidget(1, 1, widget);
		widget.setStyleName("ramka");
	}
	
	
}
